home *** CD-ROM | disk | FTP | other *** search
/ CYBER.XPO.95 / CYBER.XPO.95 (Arsenal Computer).ISO / popreq / amiga1 / a1000hks.lha / ykick / patch.S < prev    next >
Text File  |  1993-02-28  |  2KB  |  91 lines

  1. ****************************************************************************
  2. *
  3. *   patch -- patch a kickstart file for A1000 WOM usage
  4. *
  5. *   patch(filemem, kickmem, fastbeg, fastend, chipend);
  6. *   void patch(long, long, long, long, long);
  7. *
  8. *   The ZKick file loaded to 'filemem' will be patched to work at
  9. *   'kickmem' with available fast memory from 'fastbeg' to 'fastend'
  10. *   and chipmemory up to 'chipend'.
  11. *   The memory borders are to be valid *AFTER* the kickstart has been
  12. *   installed, i.e. without the 256k occupied by the first part of the
  13. *   kickfile.
  14. *
  15. ****************************************************************************
  16.  
  17.   SECTION code
  18.  
  19.   XDEF _patch
  20.  
  21. _patch:
  22.   movem.l D0-D7/A0-A6,-(sp)
  23.   move.l  64(sp),A0            ; current kickstart location
  24.   move.l  68(sp),D0            ; lower 256k block of kickstart
  25.   move.l  72(sp),D1            ; beg of MEMF_FAST (after patch)
  26.   move.l  76(sp),D2            ; end of MEMF_FAST (after patch)
  27.   move.l  80(sp),D3            ; end of MEMF_CHIP (after patch)
  28.  
  29.   tst.l   D3                   ; expansion at $80000 ?
  30.   bne.s   \chipext             ; MUST be == 0 for default $80000
  31.  
  32.   cmp.l   #$80000,D0
  33.   ble.s   \kicklast
  34.   cmp.l   D1,D0
  35.   ble.s   \kicklast
  36.  
  37.   cmp.l   #$80000,D1
  38.   ble.s   \kickfirst
  39.   cmp.l   D0,D1
  40.   ble     \kickfirst
  41.  
  42.   bra.s   \goon
  43.  
  44. \kickfirst:
  45.   move.l  D1,$1e6(A0)
  46.   bra.s   \goon
  47.  
  48. \kicklast: 
  49.   move.l  D0,$1e6(A0)
  50.   bra.s   \goon
  51.  
  52. \chipext:
  53.   move.l  D3,$1e6(A0)
  54.  
  55. \goon:
  56.  
  57.   ; checksum of the lower 256k kickstart only
  58.  
  59.   move.l  #$74007a00,$de(A0)   ; moveq #1,D2 --> moveq #0,D2 
  60.   move.l  #$fc0044,$3d4(A0)    ; enable reboot after checksum error
  61.   move.l  D1,$2b4(A0)          ; set beg of MEMF_FAST
  62.   move.l  D2,$2ba(A0)          ; set end of MEMF_FAST
  63.   move.l  D1,$2c8(A0)          ; set beg of MEMF_FAST
  64.  
  65.   sub.l   #$240000,$30c(A0)    ; library search in lower 256k bank
  66.   add.l   D0,$30c(A0)
  67.  
  68.   move.l  #$f00000,$310(A0)    ; library search in eproms and WOM
  69.   move.l  #$1000000,$314(A0)
  70.   sub.l   #$240000,$410(A0)
  71.   add.l   D0,$410(A0)
  72.   move.l  #$f00000,$414(A0)
  73.   move.l  #$1000000,$418(A0)
  74.  
  75.   adda.l  #$40004,A0
  76.   sub.l   #$f80000,(A0)        ; new reset vector
  77.   add.l   D0,(A0)
  78.  
  79.   move.l  80(sp),A0
  80.   adda.l  #$3fe00,A0
  81.   move.l  #$ffffffff,(A0)      ; checksum 1 (initially -1)
  82.  
  83.   move.l  80(sp),A0
  84.   adda.l  #$7fe00,A0
  85.   move.l  #$ffffffff,(A0)      ; checksum 2 (initially -1)
  86.  
  87.   movem.l (sp)+,D0-D7/A0-A6
  88.   rts
  89.  
  90.   END
  91.